const {PrismaClient} = require('@prisma/client');

const prisma = new PrismaClient({
    log: ['query', 'info', 'warn']
});

const getAllCookie = () => {
    return prisma.cookie.findMany();
}

const addCookie = (cookie) => {
    return prisma.cookie.create({
        data: {
            cookie
        }
    })
}

const getLastCookie = () => {
    return prisma.cookie.findFirst({
        orderBy: {
            id: 'desc'
        }
    })
}

module.exports = {
    getAllCookie,
    addCookie,
    getLastCookie
}